/*
 * Project Name: jmax
 * File Name: SendServer.java
 * Copyright: Copyright(C) 1985-2015 ZKTeco Inc. All rights reserved.
 */
package com.xdtech.hotel.protocol.server;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.jettison.json.JSONObject;

import com.xdtech.hotel.protocol.cmd.CmdManager;
import com.xdtech.hotel.protocol.util.SocketClientUtils;

/**
 * 通信发送服务，采用TCP/IP发送
 * 
 * @author <a href="max.zheng@zkteco.com">郑志雄</>
 * @version TODO 添加版本
 * @see 相关类或方法，不需要请删除此行
 * @since 2015-4-2 下午2:56:04
 */
public class SendServer
{
	private static Log log = LogFactory.getLog(SendServer.class);
	public static void runingSendService() {
		new Thread(new Runnable()
		{
			
			@Override
			public void run()
			{
				while (true)
				{
					try
					{
//				 		if (CmdManager.getCmdCount()>0)
//						{
//							String data = CmdManager.pollCmd();
//							log.info("send data content:"+data);
//							JSONObject jsonObject = new JSONObject(data);
////							SocketClientUtils.sendData(jsonObject.getString("ip"), jsonObject.getInt("port"), jsonObject.getString("cmd"));
//						}
//				 		else
//						{
//							Thread.sleep(5000);
//						}
					}
					catch (Exception e)
					{
						log.error("Send Cmd To Device Error", e);
					}
				}
			}
		}, "SendServerThread").start();
	}
}